package ar.com.fiuba.RulesMgr.rules;

import java.util.List;

import ar.com.fiuba.RulesMgr.modifiers.DummyModifer;
import ar.com.fiuba.RulesMgr.modifiers.Modifier;
import ar.com.fiuba.RulesMgr.validationModes.ValidationMode;

/**
 * Abstract class that represents a rule to be validated.
 * 
 */
public abstract class GenericRule {

	protected String ruleName;

	protected Modifier modifier = new DummyModifer();

	/**
	 * Method to perform the validation of the rule over the objects.
	 * 
	 * @param objects
	 *            objects to be tested.
	 * @return true if the condition evaluated is checked, otherwise false.
	 */
	public abstract Boolean validate(List<Object> objects);

	/**
	 * Validates the rule using the given mode and returns the result of the
	 * validation over the objects passed.
	 * 
	 * @param validationMode
	 *            the mode to be used to validate the rule.
	 * @param objects
	 *            the objects for the rule to be applied.
	 * @return true if the rule applies, otherwise false.
	 */
	public abstract Boolean validateWithMode(ValidationMode validationMode, List<Object> objects);

	public String getName() {
		return ruleName;
	}

	public void setModifier(Modifier modifier) {
		this.modifier = modifier;
	}

}
